package com.syscom.admin.controller;

import com.syscom.admin.service.SysRoleMenuService;
import com.syscom.common.entity.SysRoleMenu;
import com.syscom.common.utils.result.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author wjz
 * @Date 2021-01-14
 */
@RestController
@RequestMapping("/sysRoleMenu")
public class SysRoleMenuController {

    @Autowired
    private SysRoleMenuService sysRoleMenuService;

    @ApiOperation("SysRoleMenu查询接口")
    @GetMapping("/querySysRoleMenuById")
    public AjaxResult querySysRoleMenuById(Long objectId) {

        return sysRoleMenuService.querySysRoleMenuById(objectId);
    }

    @ApiOperation("SysRoleMenu新增接口")
    @PostMapping("/addSysRoleMenu")
    public AjaxResult addSysRoleMenu(@RequestBody SysRoleMenu sysRoleMenu) {

        return sysRoleMenuService.addSysRoleMenu(sysRoleMenu);
    }

    @ApiOperation("SysRoleMenu更新接口")
    @PatchMapping("/updateSysRoleMenu/{roleId}")
    public AjaxResult updateSysRoleMenu(@PathVariable Long roleId, @RequestBody SysRoleMenu sysRoleMenu) {

        return sysRoleMenuService.updateSysRoleMenu(roleId, sysRoleMenu);
    }

    @ApiOperation("SysRoleMenu删除接口")
    @DeleteMapping("/deleteSysRoleMenu/{objectId}")
    public AjaxResult deleteSysRoleMenu(@PathVariable Long objectId) {

        return sysRoleMenuService.deleteSysRoleMenu(objectId);
    }

}

